package com.xinsoft.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xinsoft.entity.dto.CusUpkeepEntryParam;
import com.xinsoft.entity.po.CusUpkeepEntry;
import com.xinsoft.mapper.CusUpkeepEntryMapper;
import com.xinsoft.service.CusUpkeepEntryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author lijie
* @description 针对表【cus_upkeep_entry(保养条目)】的数据库操作Service实现
* @createDate 2023-06-13 12:50:37
*/
@Service
public class CusUpkeepEntryServiceImpl extends ServiceImpl<CusUpkeepEntryMapper, CusUpkeepEntry>
    implements CusUpkeepEntryService{
    @Resource
    CusUpkeepEntryMapper cusUpkeepEntryMapper;

    @Override
    public Object findPageListByParam(CusUpkeepEntryParam param) {
        //分页
        Page<CusUpkeepEntry> page = new Page<CusUpkeepEntry>(param.getCurrentPage(), param.getPageSize());
        LambdaQueryWrapper<CusUpkeepEntry> queryWrapper = new LambdaQueryWrapper<>();
        //查询条件
        queryWrapper
                .like(StrUtil.isNotBlank(param.getUpkeepName()),CusUpkeepEntry::getUpkeepName,param.getUpkeepName())
                .like(StrUtil.isNotBlank(param.getUpkeepMethod()),CusUpkeepEntry::getUpkeepMethod,param.getUpkeepMethod());
        IPage<CusUpkeepEntry> resultPage = cusUpkeepEntryMapper.selectPage(page, queryWrapper);
        //返回值
        return resultPage;
    }
}




